package com.weather.domain;

import java.util.Date;

/**
 * @author WangKaiP
 * @Description
 * @create 2021-11-03 12:52
 */
public class Weather {

    //每天信息的ID
    private Integer id;
    //设备号
    private Integer Uid;
    //温度
    private Float temperature;
    //湿度
    private Float humidity;
    //二氧化碳浓度
    private Float co;
    //VOC:空气指数
    private Float voc;
    //风速
    private Float wind_speed;
    //风向
    private String wind_direction;
    //气压
    private Float air;
    //经度
    private Float longitude;
    //纬度
    private Float latitude;
    //当前时间
    private Date Now_date;


    public Weather() {
    }

    public Weather(int uid, float temperature, float humidity, float co, float voc, float wind_speed, String wind_direction, float air, float longitude, float latitude, Date now_date) {
        Uid = uid;
        this.temperature = temperature;
        this.humidity = humidity;
        this.co = co;
        this.voc = voc;
        this.wind_speed = wind_speed;
        this.wind_direction = wind_direction;
        this.air = air;
        this.longitude = longitude;
        this.latitude = latitude;
        Now_date = now_date;
    }

    public Integer getUid() {
        return Uid;
    }

    public void setUid(Integer uid) {
        Uid = uid;
    }

    public Float getTemperature() {
        return temperature;
    }

    public void setTemperature(Float temperature) {
        this.temperature = temperature;
    }

    public Float getHumidity() {
        return humidity;
    }

    public void setHumidity(Float humidity) {
        this.humidity = humidity;
    }

    public Float getCo() {
        return co;
    }

    public void setCo(Float co) {
        this.co = co;
    }

    public Float getVoc() {
        return voc;
    }

    public void setVoc(Float voc) {
        this.voc = voc;
    }

    public Float getWind_speed() {
        return wind_speed;
    }

    public void setWind_speed(Float wind_speed) {
        this.wind_speed = wind_speed;
    }


    public Float getAir() {
        return air;
    }

    public void setAir(Float air) {
        this.air = air;
    }

    public Float getLongitude() {
        return longitude;
    }

    public void setLongitude(Float longitude) {
        this.longitude = longitude;
    }

    public Float getLatitude() {
        return latitude;
    }

    public void setLatitude(Float latitude) {
        this.latitude = latitude;
    }

    public Date getNow_date() {
        return Now_date;
    }

    public void setNow_date(Date now_date) {
        Now_date = now_date;
    }


    public String getWind_direction() {
        return wind_direction;
    }

    public void setWind_direction(String wind_direction) {
        this.wind_direction = wind_direction;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 比较方法
     * @param o
     * @return Boolean 确定是否相等
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Weather weather = (Weather) o;

        if (Uid != null ? !Uid.equals(weather.Uid) : weather.Uid != null) return false;
        if (temperature != null ? !temperature.equals(weather.temperature) : weather.temperature != null) return false;
        if (humidity != null ? !humidity.equals(weather.humidity) : weather.humidity != null) return false;
        if (co != null ? !co.equals(weather.co) : weather.co != null) return false;
        if (voc != null ? !voc.equals(weather.voc) : weather.voc != null) return false;
        if (wind_speed != null ? !wind_speed.equals(weather.wind_speed) : weather.wind_speed != null) return false;
        if (wind_direction != null ? !wind_direction.equals(weather.wind_direction) : weather.wind_direction != null)
            return false;
        if (air != null ? !air.equals(weather.air) : weather.air != null) return false;
        if (longitude != null ? !longitude.equals(weather.longitude) : weather.longitude != null) return false;
        if (latitude != null ? !latitude.equals(weather.latitude) : weather.latitude != null) return false;
        return Now_date != null ? Now_date.equals(weather.Now_date) : weather.Now_date == null;
    }

    /**
     * 计算Hash值
     * @return INT 返回Hash值
     */
    @Override
    public int hashCode() {
        int result = Uid != null ? Uid.hashCode() : 0;
        result = 31 * result + (temperature != null ? temperature.hashCode() : 0);
        result = 31 * result + (humidity != null ? humidity.hashCode() : 0);
        result = 31 * result + (co != null ? co.hashCode() : 0);
        result = 31 * result + (voc != null ? voc.hashCode() : 0);
        result = 31 * result + (wind_speed != null ? wind_speed.hashCode() : 0);
        result = 31 * result + (wind_direction != null ? wind_direction.hashCode() : 0);
        result = 31 * result + (air != null ? air.hashCode() : 0);
        result = 31 * result + (longitude != null ? longitude.hashCode() : 0);
        result = 31 * result + (latitude != null ? latitude.hashCode() : 0);
        result = 31 * result + (Now_date != null ? Now_date.hashCode() : 0);
        return result;
    }

    /**
     * ToString 方法
     * @return 字符串类型
     */
    @Override
    public String toString() {
        return "Weather{" +
                "当前设备号为:" + Uid +
                ", 温度:" + temperature +
                ", 湿度:" + humidity +
                ", 二氧化碳:" + co +
                ", 空气质量:" + voc +
                ", 风速:" + wind_speed +
                ", 风向:" + wind_direction +
                ", 气压:" + air +
                ", 经度:" + longitude +
                ", 纬度:" + latitude +
                ", 时间:" + Now_date +
                '}';
    }
}
